package com.syxbyi._3tcp;

import java.util.HashMap;
import java.util.Map;

public class Command {

    private static Map<String, String> commandMap = new HashMap<>();
    private static final String GOODBYE = ":bye";

    static {
        commandMap.put(":bye", ":bye");
        commandMap.put(":quit", ":bye");
        commandMap.put(":exit", ":bye");
        commandMap.put(":close", ":bye");
    }

    public static boolean isGoodbyeCommand(String cmd) {
        cmd = cmd.trim();
        if (commandMap.containsKey(cmd))
            return commandMap.get(cmd).equals(GOODBYE);
        return false;
    }

    public static String getGoodbyeCommand() {
        return GOODBYE;
    }
}
